export const formatParams = (data: Record<string, any>, type?: 'formData' | 'queryString') => {
  if (type === 'formData') {
    const formData = new FormData();
    Object.entries(data).forEach(([key, value]) => {
      if (value !== undefined && value !== null) formData.append(key, JSON.stringify(value));
    });
    return formData;
  }
  if (type === 'queryString') {
    return Object.entries(data)
      .map(([key, value]) => {
        if (value !== undefined && value !== null) return `${key}=${JSON.stringify(value)}`;
        return '';
      })
      .join('&');
  }
  return data;
};
